%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Pêndulo matemático
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
figure(1);			clf;

g=9.81;				L=1;			w0=sqrt(g/L);
dt=.01;
T=[0:dt:10];
tht=pi/4;			vel=0;							%condições iniciais

The=    tht*cos(w0*T);
Vhl=-w0*tht*sin(w0*T);

for jj=1:length(T)
	tht = tht+dt *vel;
	vel = vel-dt *g/L*sin(tht);
	Tht(jj)=tht;
	Vel(jj)=vel;
end

subplot(221),plot(T,The,'r',T,Tht,'g','LineWidth',1.4)
set(gca,'xLim',[0 5],'FontSize',16,'LineWidth',1.4)
xlabel('\fontsize{16}{\it\omega}_0{\itt}/2{\it\pi}')
ylabel('\fontsize{16}{\itx}/{\itA}')
subplot(222),plot(The,Vhl/w0,'r',The,Vel/w0,'g','LineWidth',1.4)
set(gca,'FontSize',16,'LineWidth',1.4)
xlabel('\fontsize{16}{\itx}/{\itA}')
ylabel('\fontsize{16}{\itv}/{\it\omega}_0{\itA}')